import base64
import pickle
import time


def b64encode(data):
    return str(base64.b64encode(pickle.dumps(data)), encoding='utf-8')


def b64decode(data):
    return pickle.loads(base64.b64decode(bytes(data, encoding='utf8')))


def generate_timestamp_tuple(name: str, step: str):
    """
    生成时间戳元组
    """
    return ("SERVER", name, step, str(time.time()))
